package com.lanjiu.lib.imclient.dto.chat;

import com.lanjiu.pro.business.BusinessProtocolEntities;
import com.lanjiu.lib.imclient.dto.base.Dto;

/**
 * @description: 文本
 * @author: Panwei
 * @date: 2019/11/14 21:18
 */
public class TextDto extends Dto {

    // 文本内容
    private String content;

    // 文本长度
    private String length;

    public TextDto() {
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getLength() {
        return length;
    }

    public void setLength(String length) {
        this.length = length;
    }

    public TextDto(BusinessProtocolEntities.Text text) {
        this.content = text.getContent();
        this.length = text.getLength();
    }

    @Override
    public BusinessProtocolEntities.Text toProtobuf() {
        BusinessProtocolEntities.Text.Builder builder = BusinessProtocolEntities.Text.newBuilder();
        if (null != content) builder.setContent(content);
        if (null != length) builder.setLength(length);
        return builder.build();
    }
}
